home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
pctj0287.arc
/
SETFREQ.C
< prev
next >
Wrap
Text File
|
1986-12-16
|
475b
|
18 lines
/*
* setfreq -- sets PC's tone generator to run
* continuously at the specified frequency
*/
#include <conio.h>
#include "timer.h"
void
setfreq(f)
unsigned f; /* frequency in Hertz (approximate) */
{
unsigned divisor = TIMER_CLK / f;
outp(TIMER_CTRL, TIMER_PREP); /* prepare timer */
outp(TIMER_COUNT, (divisor & 0xFF)); /* low byte of divisor */
outp(TIMER_COUNT, (divisor >> 8)); /* high byte of divisor */
}